s=input().split(',')
target=eval(input())
arr=list()
for i in s:
    arr.append(eval(i))
tmp=arr.copy()
arr.sort()
st=0;ed=len(arr)-1
while(st<=ed):
    if arr[st]+arr[ed]==target:
        print(tmp.index(arr[st]),tmp.index(arr[ed]))
        exit()
    elif arr[st]+arr[ed]>target:
        ed-=1
    else:
        st+=1
print("no answer")